package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.PsychKnow;
import com.hs.mapper.PsychKnowMapper;
import com.hs.service.PsychKnowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PsychKnowServiceImpl implements PsychKnowService {
    @Autowired
    private PsychKnowMapper psychKnowMapper;
    @Override
    public int addPsychKnow(PsychKnow psychKnow) {
        return psychKnowMapper.addPsychKnow(psychKnow);
    }

    @Override
    public int deletePsychKnow(int id) {
        return psychKnowMapper.deletePsychKnow(id);
    }

    @Override
    public int updatePsychKnow(PsychKnow psychKnow) {
        return psychKnowMapper.updatePsychKnow(psychKnow);
    }

    @Override
    public PsychKnow getPsychKnowById(int id) {
        return psychKnowMapper.getPsychKnowById(id);
    }

    @Override
    public PageInfo<PsychKnow> getAllPsychKnowByPage(PsychKnow psychKnow, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<PsychKnow> list = psychKnowMapper.getAllPsychKnowByPage(psychKnow);
        PageInfo<PsychKnow> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

//    @Override
//    public PageInfo<PsychKnow> getAllPsychKnowByPage(int pageNum, int pageSize) {
//        return null;
//    }
}
